/**
 * @see [微信官方文档](https://mp.weixin.qq.com/debug/wxadoc/dev/api/file.html#wxopendocumentobject)
 * @param filePath [string] 文件路径，可通过 downFile 获得
 * @param fileType [string] 文件类型，指定文件类型打开文件，有效值 doc, xls, ppt, pdf, docx, xlsx, pptx
 */
export default function open_document(filePath: string, fileType?: 'doc' | 'xls' | 'ppt' | 'pdf' | 'docx' | 'xlsx' | 'pptx') {
	return new Promise<{
		success: boolean
	}>((resolve) => {
		wx.openDocument({
			filePath,
			fileType,
			success() {
				resolve({
					success: true
				});
			},
			fail() {
				resolve({
					success: false
				});
			}
		});
	});
}
